package com.woniuxy01;

import java.util.WeakHashMap;

/**
 * @author 作者
 * @create 2025-06-05 9:32
 */
public class Test01 {
    public static void main(String[] args) {
        String source="xxxjavaxxxxjavaxxxxjavaxxaajavaaaaaaa";
        String target="java";
        System.out.println(getCount(source, target));
    }

    public static int getCount(String source,String target) {
        int count = 0;
        int index = -1;
        do {
            index = source.indexOf(target);
            if (index != -1) {
                count++;
                source = source.substring(index + target.length());
            }else{
                break;
            }
        } while (true);
        return count;
    }
}
